package finger.dao.impl;

import finger.dao.UserDao;
import finger.domain.User;

public class UserDaoimpl extends BaseDao implements UserDao {
    @Override
    public User queryUserForUsername(String username) {
        String sql = "select * from t_user where `username`=?;";
        return getQueryForOne(User.class, sql, username);


    }

    @Override
    public User queryUserForUsernameAndPassword(String username, String password) {
        String sql = "select * from t_user where`username`=?and`password`=?;";
        return getQueryForOne(User.class, sql, username, password);
    }

    @Override
    public int save(User user) {
        String sql = "INSERT INTO t_user(`username`,`password`,`email`)VALUES(?,?,?);";
        return update(sql, user.getUsername(), user.getPassword(), user.getEmail());
    }
}
